﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Joyintech.Common;
using Joyintech.Model.inpiao365;
using Joyintech.BLL.inpiao365;
using System.Text;

namespace Joyintech.Web.inpiao365.Users
{
    public partial class filmcinema : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                //kcityid、kfilmid
                if (DNTRequest.GetQueryString("kcityid") != "" && DNTRequest.GetQueryString("kfilmid") != "")
                {
                    DataBindTheater(DNTRequest.GetQueryString("kcityid"), DNTRequest.GetQueryString("kfilmid"));
                }
            }
        }

        /// <summary>
        /// 获取指定城市、指定电影当前上映的影院
        /// </summary>
        /// <param name="cityId"></param>
        /// <param name="movieId"></param>
        private void DataBindTheater(string cityId,string movieId)
        {
            List<movieOnTheater> list = new List<movieOnTheater>();

            list = new movieOnTheater_BLL().GetModelList("cityId=" + cityId + " and movieId=" + movieId);

            StringBuilder str = new StringBuilder();

            List<movieCityArea> movieCityAreaList = new movieCityArea_BLL().GetModelList("CityId=" + cityId + " order by AreaOrder");

            foreach (movieCityArea areaModel in movieCityAreaList)
            {
                str.AppendLine("<li><strong>" + areaModel.AreaName + "</strong>");

                foreach (movieOnTheater model in list)
                {
                    if (model.AreaId == areaModel.AreaId)
                    {
                        str.AppendLine("<span class=\"dyy\"><a href=\"javascript:kchangeshow(" + model.MovieId + "," + model.TheaterId + ",'" + model.TheaterName + "');\" style=\"float: left; margin: 0; padding: 0;\">" + model.TheaterName + "</a><a href=\"/wangp/25/index.aspx?filmid=" + model.MovieId + "\" style=\"float: left; background: none;\"><img src=\"/images/icon_topic.gif\" class=\"topic\" /></a><img src=\"/images/icon_topic3.gif\" class=\"popimg2\" /></span>");
                    }
                }

                str.AppendLine("<div class=\"clr\"></div></li>");
            }

            this.litCinema.Text = str.ToString();
        }
    }
}